﻿using LocalizationUtils;
using UnityEngine;
using UnityEngine.UI;

namespace LocalizationUtils
{
    public class LocalizationArtText : MonoBehaviour
    {
        [SerializeField] private string _imageName;
        private RawImage _rawImage;
        private Image _image;

        private void Start()
        {
            _rawImage = GetComponent<RawImage>();
            if (_rawImage == null)
                _image = GetComponent<Image>();
            DoLocalization(LocalizationManager.CurrentLocale);
        }

        private void DoLocalization(string code)
        {
            if (_imageName != null)
            {
                var path = string.Format(_imageName, code);

                if (_rawImage)
                {
                    //_rawImage.LoadTexture(path);
                }
                else if (_image)
                {
                    // _image.LoadSprite(path);
                }
            }
        }
    }
}